<include file="Public:top" /> 
<script src="__PUBLIC__/Static/Uploadify/jquery.uploadify-3.1.min.js"></script>
<link href="__PUBLIC__/Static/Uploadify/uploadify.css" rel="stylesheet">
<link rel="stylesheet" href="__PUBLIC__/js/treeview/jquery.treeview.css" />
<script src="__PUBLIC__/js/treeview/jquery.cookie.js"></script>
<script src="__PUBLIC__/js/treeview/jquery.treeview.js"></script>
<style>
.imagelist{}
.imagelist li{
    background: none repeat scroll 0 0 #F0F0F0;
    border: 1px solid #E0E0E0;
    display: inline;
    float: left;
	margin-right:10px;
	margin-top:5px;
    padding: 11px;
    width: 200px;
	height:250px;
	overflow:hidden;
	position: relative;
	
}
.imagelist li em{
    color: #999999;
    display: block;
    line-height: 18px;
    padding: 8px 0px;
}

.imagelist li span.txt {
    color: #FFFFFF;
	display:none;
    line-height:25px;
	height:25px;
    width: 200px;
	text-align:right;
	position:absolute;
	top:0px;
	right:0px;
}
</style>
<script>
$(function() {
    $( "#datepicker" ).datepicker({dateFormat: "yy-mm-dd"});	
    $( "#sub_tabs" ).tabs();  
});	
$(function() {
    $( "#datepicker1" ).datepicker({dateFormat: "yy-mm-dd"});	
    $( "#sub_tabs" ).tabs();  
});
	$(function(){
		$("#browser").treeview({			
		  animated: "medium",
		});	
		$("#image_result").sortable();
		$('.imagelist li').live({
		   mouseenter:
		   function()
		   {
			  $(this).find('.txt').css('display','block');
		   },
		   mouseleave:
		   function()
		   {
			  $(this).find('.txt').css('display','none');
		   }
		});
		
		$("#upload").uploadify({
			height        : 30,
			swf           : '__PUBLIC__/Static/Uploadify/uploadify.swf',
			uploader      : '{:U("Uploadify/upload")}',
			width         : 120,
			buttonText	  : 'Upload',
			auto		  : true,
			removeCompleted: false,
			onUploadSuccess: function(file, data, response) {
				$('#progress').hide();
				var result = $.parseJSON(data);
				//错误处理。。。
				if(!data){alert(file.name+'上传失败'); return false;}
				if(result.status == 0){
					alert(file.name+result.message);
					return false;
				}
				//上传成功
				var id = Math.random().toString();
				id = id.replace('.','_'); //生成唯一标示
				var html = '<li class="imageitem" id="'+id+'" style="padding:10px;background:#FFF">';
					html+= '<input type="hidden" name="file[]" value="'+result.file_name+'">'; //隐藏域，是为了把图片地址入库。。
					html+=  '<span class="txt">';
					html+=  '<a title="del" href=javascript:remove("'+result.file_name+'","'+id+'");><img src="__PUBLIC__/Static/Uploadify/remove.png" /></a>';
					html+=  '</span>';
					html+= '<img height="200" width="200" src="'+result.file+'" />';
					html+=  '<em><textarea style=" height:20px;width:155px;" name="htmlcontent[]">'+file.name+'</textarea> </em>';
					html+=  '</li>';
				$('#image_result').append(html);
			},
			onUploadStart: function(){
				$('#progress').empty().append('<img src="__PUBLIC__/images/load.gif">');  //用户等待提示。
				$('#progress').show();
			},
			onInit: function (){  
				$("#upload-queue").hide(); //隐藏上传队列                
			}		
		});
	})
	function remove(file,id){
		$.getJSON('{:U("removeImg")}',{file:file},function(data){$('#'+id).remove()})
	}
	function removePic(id){
		$.getJSON('{:U("removePic")}',{id:id},function(data){$('#b_'+id).remove()})
	}
</script>       
	</head>
  
	<body>
    
    <div id="body-wrapper" > <!-- Wrapper for the radial gradient background -->		

        <!--left start-->
		
        <include file="Public:left" /> 
        <!--left end-->
        
        
        <!-- End #sidebar -->			
		<div id="main-content"> <!-- Main Content Section with everything -->
        <div  id="header_logo">{:C("SITE_INFO.name")}</div>	 		
			
			<!-- Page Head -->
			<div style="float:left;">
			  <h2><if condition="tep_not_null($titleArr[1])">{$titleArr[1]} <else /> New Product</if></h2></div>

            
			<div class="clear"></div> <!-- End .clear -->
			         
                <!-- Insert -->
                <div class="content-box">				
                    <div class="content-box-header">                    
                        <ul class="content-box-tabs">						
                            <li><a href="#tab1" class="default-tab current" style="text-transform:capitalize">基本信息</a></li>
	                        <li><a href="#tab2" class="">商品分类</a></li>   
                            <li><a href="#tab3" class="">联系人信息</a></li>    
                            <li><a href="#tab4" class="">图片集</a></li>                  		
                        </ul>
                        <span class="insert" style=" float:right; line-height:40px; font-size:14px; font-weight:bold;"><a href="{:U('index')}">List </a>&nbsp; &nbsp; </span> 		                            	
                      <div class="clear"></div>					
                    </div>
                   
                    <form action="{:U($action)}" method="POST" name="editForm" enctype="multipart/form-data"> 
                    <div class="content-box-content">		
                    	
                        <div class="tab-content default-tab" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->	
                        
                        <div id="sub_tabs"> 
                           <div class="tabs" id="tabs2-{$vo}">                                    
                               <table width="100%" border="0" cellspacing="0" cellpadding="0" class="editContent">
                                      <tr>
                                        <td class="fieldText">商品名称:</td><td><input class="text-input small-input" value="{$infoList.products_name}" style="width:590px!important"  type="text" id="products_name" name="products_name" /></td>
                                      </tr>
                                      <tr>  
                                        <td  class="fieldText" style="vertical-align:top;">商品描述:</td><td> <textarea style="height:300px;width:590px!important" class="page_description HTMLeditor" name="products_description">{$infoList.products_description}</textarea></td>
                                      </tr>
                               </table>  
                            <p>
                              <label>发布状态:<input type="checkbox" style="vertical-align:middle" name="products_status"  value="1" <if condition="$infoList['products_status'] eq 1">checked="checked"</if>/></label>
                                                                                               
                            </p>
                             <p>
                              <label>商品品牌:</label> <input class="text-input small-input" type="text" name="products_model" value="{$infoList.products_model}" />                                           
                            </p> 
                            
                            <p>
                              <label>商品原价:</label> <input class="text-input small-input" type="text" name="products_oldprice" value="{$infoList.products_oldprice}"/>                                            
                            </p> 
                            <p>
                              <label>商品新旧程度:</label> <input class="text-input small-input" type="text" name="products_weight" value="{$infoList.products_weight}"/>                                            
                            </p>
                           <!--  <p>
                              <label>商品买卖类型:</label> 
                               <input type="radio" name="products_showorby" value="1" <if condition="$infoList['products_showorby'] eq 1">selected="selected"</if> />卖&nbsp;&nbsp;
                               <input type="radio" name="products_showorby" value="1" <if condition="$infoList['products_showorby'] eq 2">selected="selected"</if> />买
                                                                       
                            </p>  -->
                            <p>
                              <label>商品类型:</label>
                               <input type="radio" name="products_type" value="1" <if condition="$infoList['products_type'] eq 1">checked="checked"</if> />一口价&nbsp;&nbsp;
                               <input type="radio" name="products_type" value="2" <if condition="$infoList['products_type'] eq 2">checked="checked"</if> />拍卖
                                                                     
                            </p> 
                             <p>
                              <label>一口价价格:</label> <input class="text-input small-input" type="text" name="products_price" value="{$infoList.products_price}"/>                                            
                            </p> 
                            <p>
                              <label>拍卖起步价:</label> <input class="text-input small-input" type="text" name="products_paimai_price" value="{$infoList.products_paimai_price}"/>                                            
                            </p> 
                            <p>
                              <label>拍卖截止日期:</label> <input class="text-input small-input" id="datepicker" type="text" name="products_date_available" value="{$infoList.products_date_available}"/>                                            
                            </p> 
                            <p>
                              <label>发布时间:</label> <input class="text-input small-input"  id="datepicker1" type="text" name="products_date_added" value="{$infoList.products_date_added}"/>                                            
                            </p>
                            <!--  <p>
                              <label>商品数量:</label> <input class="text-input small-input" type="text" name="products_quantity" value="{$infoList.products_quantity}"/>                                          
                            </p>   -->
                            <p>
                              <label>列表页图片:<input type="file" name="products_image">  {$imageShow}  </label>                                 
                            </p>   
                            <p>
                              <label>排序:</label> <input class="text-input small-input" type="text" name="sort_order" value="{$infoList.sort_order}"/>                                            
                            </p> 
                            <p>
                              <label>是否置顶:<input type="checkbox" style="vertical-align:middle" name="up_flag"  value="1" <if condition="$infoList['up_flag'] eq 1">checked="checked"</if>/></label>
                                                                                               
                            </p>
                            <p>
                              <label>是否加急:<input type="checkbox" style="vertical-align:middle" name="jiaji_flag"  value="1" <if condition="$infoList['jiaji_flag'] eq 1">checked="checked"</if>/></label>
                                                                                               
                            </p>
                             <p>
                              <label>是否推荐:<input type="checkbox" style="vertical-align:middle" name="recommend"  value="1" <if condition="$infoList['recommend'] eq 1">checked="checked"</if>/></label>
                             </p>
                             <p>
                              <label>是否关闭:<input type="checkbox" style="vertical-align:middle" name="products_close"  value="1" <if condition="$infoList['products_close'] eq 1">checked="checked"</if>/></label>
                             </p>
                             <p>
                              <label>关闭原因:<input type="text" class="text-input small-input" style="vertical-align:middle" name="close_reason"  value="{$infoList.close_reason}"/></label>
                             </p>
                             <p>
                              <label>是否卖出:<input type="checkbox" style="vertical-align:middle" name="show_flag"  value="1" <if condition="$infoList['show_flag'] eq 1">checked="checked"</if>/></label>
                             </p>
                            <p>
                        		    商品所在地： {:W('Shengshi',array('now_city_id'=>$infoList['citycode'],'now_prov_id'=>$infoList['provcode'],'now_area_id'=>$infoList['area_id']))}
                            </p>
                            </div>   
                        </div>
                        
                        </div> <!-- End #tab1 --> 
                        
                        <div class="tab-content" id="tab2" style="display: none;"> <!-- This is the target div. id must match the href of this div's tab -->	
       
                              <ul id="browser" class="filetree">
                               	{$cate}   
							  </ul>             
                                   

                            	
                        </div>   <!-- End #tab2 --> 
                        <div class="tab-content" id="tab3" style="display: none;"> <!-- This is the target div. id must match the href of this div's tab -->	
                            <p>
                              <label>联系人:</label> <input class="text-input small-input" type="text" name="contact_person" value="{$infoList.contact_person}"/>                                            
                            </p>
                            <p>
                              <label>联系电话:</label> <input class="text-input small-input" type="text" name="contact_tel" value="{$infoList.contact_tel}"/>                                            
                            </p> 
                            <p>
                              <label>联系qq:</label> <input class="text-input small-input" type="text" name="contact_qq" value="{$infoList.contact_qq}"/>                                            
                            </p> 
                            <p>
                              <label>联系微信:</label> <input class="text-input small-input" type="text" name="contact_wechat" value="{$infoList.contact_wechat}"/>                                            
                            </p>
                            <p>
                              <label>联系人详细地址:</label> <input class="text-input small-input" type="text" name="contact_address" value="{$infoList.contact_address}"/>                                            
                            </p>
                            <p>
                              <label>信息发布人:</label>{$infolist.member_name} <input class="text-input small-input" type="hidden" name="member_id" value="{$infoList.member_id}"/>                                            
                            </p>   
                         </div>
                          <div class="tab-content" id="tab4" style="display: none;"> <!-- This is the target div. id must match the href of this div's tab -->	
                            
                            <p>
                              <label>图片集:<span><a style="float:right" id="upload"></a></span><div id="progress" style="position:fixed;left:50%;top:50%; z-index:999"></div>
                              <ul class="imagelist" id="image_result">
                              <foreach name="BigImg" item="v">
                              	<li class="imageitem" id="b_{$v['id']}" style="padding:10px;background:#FFF">
                                	<span class="txt">
                                    <a title="Delete" href=javascript:removePic("{$v['id']}");><img src="__PUBLIC__/Static/Uploadify/remove.png" /></a>
                                    </span>
                                    <a class="fancyBox"  href="__PUBLIC__/images/products/{$v['image']}"><img height="200" width="200" src="__PUBLIC__/images/products/{$v['image']}" /></a>
                                    <em><textarea name="imgcontent[{$v['id']}]" style="height:20px;width:200px;">{$v['htmlcontent']}</textarea><input type="hidden" name="img_sort[]" value="{$v.id}"/></em>
                               </li>
                              </foreach>
                              </ul>
                              <div class="clear"></div></label>                       
                            </p>  
                            	
                        </div>   <!-- End #tab3 --> 
                              	
                    </div>  
                          <div style="padding:0 0 20px 20px">  
                            <input  name="products_id" value="{$infoList.products_id}" type="hidden"/>
                            <input class="button" style="text-transform:capitalize" type="button" name="BtnSave" onClick="document.editForm.submit()"  value="{$actionName}" />&nbsp;&nbsp;
                            <input class="button" type="button" name="back" onClick="window.location.href='{:U('index')}'"  value="Back" />   
                          </div>  
                    </form>     
                	
                </div> 
                <!--End Insert -->
        
			
			
			<div class="clear"></div>
			
			
			<!-- Start Notifications -->
			
			

			
			<!-- End Notifications -->
			
            <div id="footer">
				<small> <!-- Remove this notice or replace it with whatever you want -->
						&#169; Copyright 2013
				</small>
			</div>
			
			
			
			<!-- End #footer -->
			
		</div> <!-- End #main-content -->
		
	</div>
	
	<script>
    	$(function(){
					$('.content-box-content ul.tab-content').hide(); // 先隐藏DIV
					$('ul.content-box-tabs li a.default-tab').addClass('current'); // 给默认的选项卡加样式
					$('.content-box-content ul.default-tab').show(); //
					 
					$('ul.content-box-tabs li a').click( //
					function() {
						$(this).parent().siblings().find("a").removeClass('current'); //
						$(this).addClass('current'); //
						var currentTab = $(this).attr('href'); //
						$(currentTab).siblings().hide(); //
						$(currentTab).show(); //
						return false;
					}
			);
			 $( "#sub_tabs" ).tabs();  
		});
    
     function delImages()
		{
			  $("#image").html('');
			  $("input[name=del_iamge]").val("true");			  
		} 
    
    </script>
	
	</body>
<!-- Download From www.exet.tk-->
</html>